using System;
using System.Collections.Generic;
using System.Text;
using Bifrost;

namespace TextEditor
{
    public class A_SaveDB : A_Action
    {
        public A_SaveDB()
        {
            //App.A_Commit += new EventHandler(SaveDB);            
        }

        public override string ActionName()
        {
            return "savedb";
        }

        public override A_Action Clone()
        {
            A_SaveDB as2 = new A_SaveDB();
            as2.BaseCloneFrom(this);
            return as2;
            
        }

        public override bool Execute()
        {
            base.myOwnerDocument.ToXMLFile(base.Param1);
            base.myOwnerDocument.Modified = false;

           
            return true;
        }

        private void SaveDB(object sender, EventArgs e)
        {
            if (base.myOwnerDocument.flag == -1)
            {
               // base.myOwnerDocument.saveDocument(base.myOwnerDocument.pid, frmText.textKind_ID, frmText.belong_ToSys_ID, frmText.sickKind_ID, frmText.textName);
                App.A_Commit = null;
            }
            else
            {
                base.myOwnerDocument.saveTemplate(base.myOwnerDocument.Us.Tid);
                App.A_Commit = null;
            }
            //UIExecute();
        }

        //public override bool UIExecute()
        //{
            
        //    return true;
        //}
    
    }
}
